package com.rongke.enums;

/**
 * Created by bilibili on 2017/8/4.
 */
public enum OrderStatusEnum {
    //    订单状态(1待付款 2 待发货 3 已发货（用户待收货） 4 已完成  5 退款中 **后面都是已关闭** 6 自动取消 7 买家取消 8 商家取消 9 维权完成（已退款）)
    WAIT_PAY(1, "待付款"), WAIT_SHIP(2, "待发货"), DELIVERING(3, "已发货"), COMPLETE(4, "已完成"),PENDING_EVALUATION (5,"待评价"),AUTO_CANCELED(6, "自动取消"), PURCHASER_CANCELED(7, "买家取消"), MERCHANT_CANCELED(8, "商家取消"), REFUNDED(9, "维权完成(已退款)"), ON_REFUND(10, "退款中"),BUYTOGETHER(11,"已拼团");


    private Integer type;
    private String typeName;

    OrderStatusEnum(Integer type, String typeName) {
        this.type = type;
        this.typeName = typeName;
    }

    /**
     * 根据type 获取typeName
     *
     * @param type
     * @return
     */
    public static OrderStatusEnum getOrderStatusNameByType(Integer type) {
        for (OrderStatusEnum userTypeEnum : values()) {
            if (userTypeEnum.getType().equals(type)) {
                return userTypeEnum;
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
}
